package com.zed.games.answer;

import com.zed.api.games.ActionReply;
import com.zed.api.games.Game;
import com.zed.api.games.GameException;
import com.zed.api.games.answer.AnswerGameLevel;
import com.zed.api.games.answer.action.AnswerAction;
import com.zed.api.games.answer.show.AnswerShowWorld;

import java.util.Objects;

/**
 * 缺省的游戏关卡
 *
 * @author Zed
 */
public class DefaultAnswerGameLevel extends AnswerGameLevel {

    private AnswerShowWorld answerShowWorld;

    protected DefaultAnswerGameLevel() {

    }

    public DefaultAnswerGameLevel(Game game, AnswerShowWorld answerShowWorld, AnswerGameLevel parentGameLevel, AnswerGameLevel nextGameLevel) {
        super(game, parentGameLevel, nextGameLevel);
        this.answerShowWorld = Objects.requireNonNull(answerShowWorld, "\"answerShowWorld\" cannot be null.");
    }

    @Override
    protected ActionReply doInvoke(AnswerAction action) throws GameException {
        return UnifyAnswerActionProcessor.getInstance().processor(this, action);
    }

    @Override
    public AnswerShowWorld getShowWorld() {
        return this.answerShowWorld;
    }
}
